home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / t2win-32 / _crypt.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-24  |  7.7 KB  |  209 lines

  1. VERSION 4.00
  2. Begin VB.Form frmCrypt 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Crypt"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    Height          =   5250
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   7605
  18.    Begin VB.TextBox txt_Result 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   4110
  22.       Left            =   105
  23.       Locked          =   -1  'True
  24.       MultiLine       =   -1  'True
  25.       ScrollBars      =   2  'Vertical
  26.       TabIndex        =   0
  27.       Top             =   630
  28.       Width           =   7260
  29.    End
  30.    Begin Threed.SSPanel SSPanel1 
  31.       Align           =   1  'Align Top
  32.       Height          =   480
  33.       Left            =   0
  34.       TabIndex        =   1
  35.       Top             =   0
  36.       Width           =   7485
  37.       _Version        =   65536
  38.       _ExtentX        =   13203
  39.       _ExtentY        =   847
  40.       _StockProps     =   15
  41.       ForeColor       =   -2147483640
  42.       BackColor       =   12632256
  43.       Begin VB.ComboBox cmb_Function 
  44.          Height          =   315
  45.          Left            =   1365
  46.          TabIndex        =   2
  47.          Top             =   90
  48.          Width           =   4785
  49.       End
  50.       Begin Threed.SSCommand cmdNP 
  51.          Height          =   300
  52.          Index           =   1
  53.          Left            =   7140
  54.          TabIndex        =   6
  55.          Top             =   90
  56.          Width           =   255
  57.          _Version        =   65536
  58.          _ExtentX        =   450
  59.          _ExtentY        =   529
  60.          _StockProps     =   78
  61.          Caption         =   ">"
  62.          BevelWidth      =   1
  63.          Font3D          =   3
  64.          RoundedCorners  =   0   'False
  65.          Outline         =   0   'False
  66.       End
  67.       Begin Threed.SSCommand cmdNP 
  68.          Height          =   300
  69.          Index           =   0
  70.          Left            =   6300
  71.          TabIndex        =   5
  72.          Top             =   90
  73.          Width           =   255
  74.          _Version        =   65536
  75.          _ExtentX        =   450
  76.          _ExtentY        =   529
  77.          _StockProps     =   78
  78.          Caption         =   "<"
  79.          BevelWidth      =   1
  80.          Font3D          =   3
  81.          RoundedCorners  =   0   'False
  82.          Outline         =   0   'False
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "&Select a function"
  86.          Height          =   255
  87.          Left            =   90
  88.          TabIndex        =   4
  89.          Top             =   120
  90.          Width           =   1275
  91.       End
  92.       Begin Threed.SSCommand SSCommand1 
  93.          Default         =   -1  'True
  94.          Height          =   300
  95.          Left            =   6615
  96.          TabIndex        =   3
  97.          Top             =   90
  98.          Width           =   465
  99.          _Version        =   65536
  100.          _ExtentX        =   820
  101.          _ExtentY        =   529
  102.          _StockProps     =   78
  103.          Caption         =   "&Go"
  104.          BevelWidth      =   1
  105.          RoundedCorners  =   0   'False
  106.          Outline         =   0   'False
  107.       End
  108.    End
  109. Attribute VB_Name = "frmCrypt"
  110. Attribute VB_Creatable = False
  111. Attribute VB_Exposed = False
  112. Option Explicit
  113. Option Base 1
  114. Private Const Iteration = 10
  115. Dim IsLoaded         As Integer
  116. Dim TimerStartOk     As Integer
  117. Dim TimerCloseOk     As Integer
  118. Dim TimerHandle      As Integer
  119. Dim TimerValue       As Long
  120. Private Sub cmdNP_Click(Index As Integer)
  121.    Call sub_NextPrev(cmb_Function, Index)
  122. End Sub
  123. Private Sub cmb_Function_Click()
  124.    If (IsLoaded = False) Then Exit Sub
  125.    Call cDisableFI(mdiT2W.Picture1)
  126.    txt_Result = ""
  127.    DoEvents
  128.    Select Case cmb_Function.ListIndex
  129.       Case 0
  130.          Call TestFileCrypt
  131.       Case 1
  132.          Call TestCrypt
  133.    End Select
  134.    DoEvents
  135.    Call cEnableFI(mdiT2W.Picture1)
  136. End Sub
  137. Private Sub Form_Activate()
  138.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  139. End Sub
  140. Private Sub Form_Load()
  141.    IsLoaded = False
  142.    Show
  143.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_crypt.t2w")
  144.    IsLoaded = True
  145. End Sub
  146. Private Sub SSCommand1_Click()
  147.    Call cmb_Function_Click
  148. End Sub
  149. Private Sub TestFileCrypt()
  150.    Dim lngResult        As Long
  151.    Dim strResult        As String
  152.    Dim strDisplay       As String
  153.    Dim i                As Integer
  154.    Dim File1            As String
  155.    Dim File2            As String
  156.    Dim File3            As String
  157.    strResult = ""
  158.    strDisplay = ""
  159.    File1 = T2WFileTest
  160.    File2 = "autoexec.hi-encrypted"
  161.    File3 = "autoexec.hi-decrypted"
  162.    strDisplay = strDisplay & "File Crypt '" & File1 & "' to '" & File2 & "' with password '1234567' is " & cFileCrypt(File1, File2, "1234567") & vbCrLf
  163.    strDisplay = strDisplay & "File Crypt '" & File2 & "' to '" & File3 & "' with password '1234567' is " & cFileCrypt(File2, File3, "1234567") & vbCrLf
  164.    strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
  165.    txt_Result = strDisplay
  166.    'time the function
  167.    TimerHandle = cTimerOpen()
  168.    TimerStartOk = cTimerStart(TimerHandle)
  169.    For i = 1 To Iteration
  170.       lngResult = cFileCrypt(File1, File2, "1234567")
  171.    Next i
  172.    lngResult = cFileCrypt(File2, File3, "1234567")
  173.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  174.    TimerCloseOk = cTimerClose(TimerHandle)
  175. End Sub
  176. Public Sub TestCrypt()
  177.    Dim lngResult        As Long
  178.    Dim strResult        As String
  179.    Dim strDisplay       As String
  180.    Dim i                As Integer
  181.    Dim Str1             As String
  182.    Dim Str2             As String
  183.    Dim Str3             As String
  184.    strResult = ""
  185.    strDisplay = ""
  186.    Str1 = "T2WIN-32, t2win-32, T2WIN-32, t2win-32, T2WIN-32, t2win-32"
  187.    Str2 = cCrypt(Str1, "1234567")
  188.    Str3 = cCrypt(Str2, "1234567")
  189.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  190.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  191.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  192.    Str1 = String$(30, "a") + String$(6, "b") + String$(5, "c") + String$(4, "d")
  193.    Str2 = cCrypt(Str1, "1234567")
  194.    Str3 = cCrypt(Str2, "1234567")
  195.    strDisplay = strDisplay & "Crypt '" & Str1 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str2 & "'" & vbCrLf & vbCrLf
  196.    strDisplay = strDisplay & "Crypt '" & Str2 & "'" & vbCrLf & "with password '1234567'" & vbCrLf & "is" & vbCrLf & "'" & Str3 & "'" & vbCrLf & vbCrLf
  197.    strDisplay = strDisplay & "Compare string contents (not sensitive) is " & IIf(LCase$(Str1) = LCase$(Str3), "same", "not same") & vbCrLf & vbCrLf
  198.    txt_Result = strDisplay
  199.    'time the function
  200.    TimerHandle = cTimerOpen()
  201.    TimerStartOk = cTimerStart(TimerHandle)
  202.    For i = 1 To Iteration
  203.       Str2 = cCrypt(Str1, "1234567")
  204.    Next i
  205.    Str3 = cCrypt(Str2, "1234567")
  206.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  207.    TimerCloseOk = cTimerClose(TimerHandle)
  208. End Sub
  209.